package vo
{
	import flash3.net.ByteArrayPlus;

	public class PrizesPool implements ISocket
	{
		public static const MAX_PRIZESPOOL:uint = 8;
		public var wKindID:uint;							//类型标识
		public var wServerID:uint;							//房间号码
		public var item:Array = [];						//奖金池
		
		public function PrizesPool()
		{
		}
		
		public function read(bap:ByteArrayPlus):void
		{
			clear();
			wKindID = bap.readShort();
			wServerID = bap.readShort();
			var nPoolCount:uint = bap.readInt();
			for(var i:uint = 0; i < nPoolCount; i++)
			{
				item.push({score:bap.readInt(),gold:bap.readInt()});
			}
		}
		public function write(bap:ByteArrayPlus):void
		{
			
		}
		
		public function get goldTotal():Number
		{
			var total:uint = 0;
			for(var i:uint = 0; i < item.length; i++)
				total += item[i].gold;
			return total;
		}
		
		public function clear():void
		{
			item.length = 0;
		}
	}
}